package com.jeecms.wicool.manager.lottery.impl;



import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeecms.cms.entity.main.CmsUser;
import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.wicool.dao.lottery.SnDao;
import com.jeecms.wicool.entity.lottery.Sn;
import com.jeecms.wicool.manager.lottery.SnMng;

@Service
@Transactional
public class SnMngImpl implements SnMng {
	
	private SnDao dao;
	@Autowired
	public void setDao(SnDao dao) {
		this.dao = dao;
	}
	
	@Transactional(readOnly = true)
	public Pagination getPage(String prizeName,Integer status,String sn, int pageNo, int pageSize,CmsUser user) {
		Pagination page = dao.getPage( prizeName, status, sn, pageNo, pageSize, user);
		return page;
	}
	@Override
	public Sn findById(Integer id) {
		Sn entity = dao.findById(id);
		return entity;
	}

	@Override
	public Sn update(Sn bean) {
		Updater<Sn> updater = new Updater<Sn>(bean);
		bean = dao.updateByUpdater(updater);
		return bean;
	}
	@Override
	public Sn save(Sn bean) {
		dao.save(bean);
		return bean;
	}

	@Override
	public Sn deleteById(Integer id) {
		Sn bean = dao.deleteById(id);
		return bean;
	}
	@Override
	public Sn[] deleteByIds(Integer[] ids) {
		Sn[] beans = new Sn[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}
	@Override
	public List<Sn> getAll(CmsUser user) {
		return dao.getAll(user);
	}
	
}